Repository navigation
refactor(stack-encrypt)!: remove the seven PlanError variants nothing raises - #1749
Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
🟢 Approval recommended
The obsolete PlanError cleanup has no active review issues.
No open issues 🎉
What changed in this PR
Removes seven unused PlanError variants left behind by the deleted Stack Encrypt plan builder, completing the cleanup in #1671. This breaks references to the removed variants but leaves stored bytes and remaining error codes unchanged.
Changes:
- Removes obsolete variants, diagnostic codes, payload handling, and dynamic mappings.
- Updates error-code and Go guest status tests to use a remaining variant.
- Clarifies match-query configuration guarantees and documents replacements for
DefaultIndexand.via, with upgrade guidance.
| File | Description |
|---|---|
packages/stack-encrypt/src/target/index.rs |
Clarifies how field-reference queries use Match<O>. |
packages/stack-encrypt/src/sem/mod.rs |
Documents configuration agreement and direct-filter limitations. |
packages/stack-encrypt/src/plan/error.rs |
Removes seven unused variants and their payload handling. |
packages/stack-encrypt/src/dynamic/record.rs |
Removes obsolete error mappings and test cases. |
packages/stack-encrypt/src/codes.rs |
Updates diagnostic-code and payload tests. |
packages/stack-encrypt/docs/adr/0009-operators-select-the-index-and-a-query-term-is-not-the-stored-term.md |
Records typed and data-plan operator selection replacements. |
packages/stack-encrypt/CHANGELOG.md |
Adds breaking-change guidance and documentation notes. |
languages/golang/encrypt/guest/src/status.rs |
Uses BindInQuery in the plan-error status test. |
docs/plans/2026-10-24-stack-encrypt-api-plan.md |
Updates the cleanup tracking for #1671. |
Review effort: Balanced
Mutation testing (cargo-mutants,
|
| caught | missed | unviable | timeout |
|---|---|---|---|
| 1 | 0 | 3 | 0 |
Every mutant in the changed lines was caught by a test.
cipherstash-agent
left a comment
There was a problem hiding this comment.
Review attestation
Reviewed a98951b7 · posted from Claude Code · claude-opus-5-5 · effort medium
Sources: code-review (medium) · claude-opus-5-5; rust-security · claude-opus-5-5; mattpocock-skills:code-review · claude-opus-5-5
Skills: code-review, rust-security, mattpocock-skills:code-review, review-cross-check, review-post
Findings (5): 5 minor — 3 inline, 2 below.
packages/stack-encrypt/docs/adr/0009-operators-select-the-index-and-a-query-term-is-not-the-stored-term.md:4(outside diff) minor Front matter still saysamended: 2026-11-10; this PR adds the 2026-11-23 amendment, and the 2026-11-22 (#1737) one never bumped it either. Setamended: 2026-11-23. Source: code-review (medium)docs/plans/2026-10-24-stack-encrypt-api-plan.md:2466(outside diff) minor The naming table still listsIndexNotDeclaredas a confirmed dynamic interface name, while line 2313 records its removal. Drop it, or mark it removed (#1671). Source: code-review (medium)
Every finding was verified at head. No correctness or security defect was found: none of the seven variants is raised at base, and the two refusals that remain (passthrough_with_outputs, outputs_with_target) are still raised. Build not run in this review (offline cargo could not fetch a git dependency); verification was by reading the code.
Generated by Claude Code
… raises The plan builder and the chain are gone, and with them the only code that raised seven `PlanError` variants: `IdentityWithoutField`, `IndexNotDeclared`, `IndexOptions`, `MixedCiphers`, `NoContext`, `PassthroughIndexed` and `TargetWithVerbs`. A search of the workspace, the Go guest and the EQL crates finds no constructor outside tests: each was only matched in `dynamic::record`'s refusal mapping and listed in the error-code tests. A reader of the error docs saw refusals that cannot happen. Each variant goes with its error code, its payload arm and its arm in the `dynamic::Reason` mapping; `index_value`, used only by the `IndexOptions` payload, goes too. No `dynamic::Reason` is removed: the parser still raises `passthrough_with_outputs` and `outputs_with_target` itself, and `refused` still covers `TwoContextSources` and `ContextNotStorable`. The codes are names, not numbers, so the remaining ones are unchanged. The Go guest's status table maps `Error::Plan(_)` as a whole to `STATUS_ENCODING` and has no entry per variant; its test now uses `BindInQuery`. No conformance corpus or Go error test names a removed code. ADR-0009 is amended to say what replaced `DefaultIndex` and `.via`: a typed field answers through its target type's `Answers`, and a data plan through `Op::answered_by`. The `MatchConfig`, `match_terms` and `Match` docs no longer claim a field and its query agree "by construction": they say how a query made from the field's reference takes the field's own `Match<O>`, and that a filter derived directly matches only under the field's configuration. No stored byte changes. Closes #1671
The codes tests imported `IndexSpec` at module level, but only the two helpers gated on the `dynamic` feature use it, so a build without `dynamic` (the WASI guest's `--no-default-features` shape, which CI builds with `-D warnings`) failed on an unused import. The import now sits in those two helpers. The CHANGELOG and ADR-0009 no longer say the plan builder raised all seven variants: `plan::all` raised `MixedCiphers`, the builder the other six. ADR-0009 names `dynamic::Op::answered_by` rather than `Op`, which reads as the operator parameter of `Answers<Op, In>`, and its front matter records the 2026-11-23 amendment. The API plan's naming table no longer lists `IndexNotDeclared` as a confirmed name, and a rustdoc paragraph in `sem` is rewrapped.
a98951b to
f8d29e9
Compare
|
Review round 1 and the CI failure, addressed in f8d29e9. The branch was rebased onto #1748's new head (ba11786) and force-pushed. The rebase applied with no conflicts.
Checks at f8d29e9:
|
coderdan
left a comment
There was a problem hiding this comment.
Human pass. LGTM.
Summary
PlanErroris the error Stack Encrypt refuses a declaration with. Seven of its variants can no longer be returned, because the plan builder that raised them has been removed. They're now removed too, with their error codes, so the error docs no longer list refusals that can't happen. This breaks only code that matches on these variant names, and no stored byte changes. ADR-0009 now says what replacedDefaultIndexand.via. The match-index docs no longer claim that a field and its query agree "by construction".Changes
IdentityWithoutField,IndexNotDeclared,IndexOptions,MixedCiphers,NoContext,PassthroughIndexedandTargetWithVerbs. Each went with itsstack_encrypt::plan_*code, its payload arm and its arm in thedynamic::Reasonmapping.index_valueis also removed; onlyIndexOptionsused it.NoContextas their sample plan error; they now useBindInQuery.Answers, and a data plan throughOp::answered_by.MatchConfig,KeysetCipher::match_termsandMatchdocs now say how a field and its query agree:Match<O>;Verification
packages/andlanguages/: nothing outside tests constructs any of the seven.cargo fmt --check, plus clippy andcargo docwith-D warnings: clean.cargo test -p stack-encrypt --all-features: all test binaries pass.--features eql. Nextest passes 82 tests, and 85 with--features eql.go generate ./...produces no drift, andgo test ./...passes.Related
Closes #1671. Part of #1488. Stacked on #1748.
Review notes
dynamic::Reasonis removed; each remaining reason is still raised elsewhere.STATUS_ENCODINGwithout listing variants, so only its test changed.